import 'package:flutter/cupertino.dart';
import 'package:flutter_basic_learning/utils/CommonWidget.dart';
import 'package:flutter_basic_learning/views/getx/getx_controller/DataShareController.dart';
import 'package:flutter_basic_learning/views/getx/getx_controller/PageTwo.dart';
import 'package:get/get.dart';

class PageOne extends StatelessWidget {
  PageOne({super.key});

  final DataShareController shareData = Get.put(DataShareController());

  @override
  Widget build(BuildContext context) {
    return commonScaffold('多页面数据共享 - 页面1', [
      Obx(() => commonText('多页面共享数据： ${shareData.count.value}')),
      commonButton('count+1', () {
        shareData.count.value++;
      }),
      commonButton('跳转页面2', () {
        Get.to(() => PageTwo());
      })
    ]);
  }
}
